package com.bbs.services;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.bbs.bean.BbsReplyInfo;
import com.bbs.dao.BbsReplyInfoDao;

@Transactional
@Service
public class BbsReplyInfoManager {
	private BbsReplyInfoDao bbsReplyInfoDao;

	
	public BbsReplyInfoDao getBbsReplyInfoDao() {
		return bbsReplyInfoDao;
	}


	public void setBbsReplyInfoDao(BbsReplyInfoDao bbsReplyInfoDao) {
		this.bbsReplyInfoDao = bbsReplyInfoDao;
	}


	public void save(BbsReplyInfo bbsReplyInfo){
		bbsReplyInfo.setReplyTime(new SimpleDateFormat("yyyy-MM-dd").format(new Date()));
		bbsReplyInfoDao.save(bbsReplyInfo);
	}
	
	public void update(BbsReplyInfo bbsReplyInfo){
		bbsReplyInfoDao.update(bbsReplyInfo);
	}
	
	public void delete(int id){
		bbsReplyInfoDao.deleteById(id);
	}
	
	public List findAll(){
		return bbsReplyInfoDao.findAll();
	}


	public BbsReplyInfo findId(int id) {
		return bbsReplyInfoDao.getById(id);
	}


	public List getReplyByTitleId(Integer replyTitleid,Integer page) {
		return bbsReplyInfoDao.getReplyByTitleId(replyTitleid,page);
		
	}
} 
